<template>
	<view class="order-success">
	<!-- 	<view class="lamp">
			<image class="lamp-pic" src="../../static/images/icon/lamp.png"></image>
			<view class="lamp-text">文本跑马灯，文本跑马灯，文本跑马灯，文本跑马灯，文本跑马灯，文本跑马灯！</view>
			<image class="delete-pic" src="../../static/images/icon/de.png"></image>
		</view> -->
		
		<view class="status-area app-bac-color">
			<view class="top">
				<image class="suc-pic" src="../../static/images/icon/suc.png"></image>
				<view class="success">下单成功</view>
			</view>
			<view class="mid">订单已提交，审核通过后将及时发货，<br/>审核结果会及时来电通知，请保持手机通话畅通～</view>
			<view class="btm">
				<view class="btn retun" @click="goIndex">返回首页</view>
				<view class="btn check app-font-color" @click="goOrderDetails">查看订单</view>
			</view>
		</view>
		<view class="accelerated-review">
			<view class="accelerate" v-if="!is_attestation" @click="goAttestation">
				<view class="left">
					<view class="above">
						<image class="suc-pic" src="../../static/images/icon/process.png"></image>
						<view class="title">加速审核</view>
					</view>
					<view class="illustrate">上传身份证照片，提高您的审核通过率！</view>
				</view>
				<view class="right">
					<view class="r-text app-font-color">去认证</view>
					<text class="iconfont icon-xiangyou app-font-color"></text>
				</view>
			</view>
			
			<view class="data-list">
				<view class="item">
					<view class="lebel">首期应付租金</view>
					<view class="val">¥{{order_pay_info.bill.first_stage_price}}</view>
				</view>
				<view class="item">
					<view class="lebel">冻结押金</view>
					<view class="val">¥{{order_pay_info.deposit_price}}</view>
				</view>
				<view class="item">
					<view class="lebel">总租金</view>
					<view class="val">¥{{order_pay_info.rent_price}}</view>
				</view>
				<view class="item">
					<view class="lebel">配送方式</view>
					<view class="val">{{order_pay_info.delivery_mode_label}}</view>
				</view>
				<view class="item">
					<view class="lebel">租赁方式</view>
					<view class="val">{{order_pay_info.bill.lease_way}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		isAttestation,
	} from '@/api/user.js';
	import {
		getOrderDetail
	} from '@/api/order.js';
	
	export default {
		data() {
			return {
				order_pay_info: {},
				is_attestation: false
			}
		},
		onLoad: function(options) {
			let that = this;
			this.options = options
			if (!options.order_id) return this.$util.Tips({
				title: '缺少参数无法查看订单支付状态'
			})
			this.orderId = options.order_id;
			this.getOrderPayInfo();
		},
		onShow() {
			let that = this;
			isAttestation().then(res => {
				if (res.status == 200) {
					that.$set(that, 'is_attestation', res.data.is_attestation);
				}
			})
		},
		methods: {
			goAttestation() {
				uni.navigateTo({
					url: '/pages/lease/real-name'
				})
			},
			getOrderPayInfo: function() {
				let that = this;
				uni.showLoading({
					title: '正在加载中'
				});
				getOrderDetail(that.orderId).then(res => {
					uni.hideLoading();
					that.$set(that, 'order_pay_info', res.data);
				}).catch(err => {
					uni.hideLoading();
				});
			},
			/**
			 * 去首页关闭当前所有页面
			 */
			goIndex: function(e) {
				uni.switchTab({
					url: '/pages/index/index'
				});
			},
			/**
			 * 
			 * 去订单详情页面
			 */
			goOrderDetails: function(e) {
				uni.redirectTo({
					url: '/pages/goods/order_list/index?status='
				})
			}
		}
	}
	
</script>

<style lang="scss">
	page { background-color: #F5F7FA; }
	
	.order-success {
		width: 750rpx;
		
		.lamp {
			display: flex;
			align-items: center;
			height: 64rpx;
			line-height: 64rpx;
			padding: 0 24rpx;
			background: #FFF1D6;
			
			.lamp-pic {
				width: 32rpx;
				height: 30rpx;
				background: #FF7029;
				margin-right: 16rpx;
			}
			
			.lamp-text {
				width: 100%;
				overflow: hidden;
				white-space: nowrap;
				font-size: 24rpx;
				font-weight: 400;
				color: #FF7029;
			}
			
			.delete-pic {
				width: 24rpx;
				height: 24rpx;
				margin-left: 16rpx;
			}
		}
		
		.status-area {
			padding: 52rpx 0 72rpx 0;
			background: #5ACCBD;
			
			.top {
				display: flex;
				justify-content: center;
				align-items: center;
				
				.suc-pic {
					width: 40rpx;
					height: 40rpx;
					margin-right: 22rpx;
				}
				
				.success {
					font-size: 40rpx;
					font-weight: 500;
					color: #FFFFFF;
					line-height: 40rpx;
				}
			}
			
			.mid {
				text-align: center;
				margin: 20rpx 0 48rpx 0;
				font-size: 24rpx;
				color: #FFFFFF;
				line-height: 40rpx;

			}
			
			.btm {
				display: flex;
				justify-content: center;
				
				.btn {
					width: 208rpx;
					height: 76rpx;
					line-height: 76rpx;
					text-align: center;
					border-radius: 38rpx;
					font-size: 28rpx;
					font-weight: bold;
				}
				
				.retun {
					margin-right: 48rpx;
					border: 2rpx solid #FFFFFF;
					color: #FFFFFF;
				}
				
				.check {
					background: #FFFFFF;
					color: #39CCC2;
				}
			}
		}
		
		.accelerated-review {
			position: relative;
			left: 0;
			top: -24rpx;
			background: #F5F7FA;
			width: 100%;
			border-radius: 24rpx 24rpx 0 0;
			padding: 24rpx;
			
			.accelerate {
				display: flex;
				align-items: center;
				padding: 32rpx 24rpx;
				height: 152rpx;
				background: linear-gradient(180deg, #ffefee 0%, #fffefd 50%, #fff 100%);
				border: 2rpx solid #FFFFFF;
				border-radius: 16rpx;
				
				.left {
					flex: 1;
					
					.above {
						display: flex;
						
						.suc-pic {
							width: 48rpx;
							height: 48rpx;
						}
						
						.title {
							margin-left: 16rpx;
							font-size: 32rpx;
							font-weight: bold;
							color: #FF271F;
							line-height: 32rpx;
						}
					}
					
					
					.illustrate {
						margin-top: 16rpx;
						font-size: 24rpx;
						font-weight: 400;
						color: #FF4E47;
						line-height: 24rpx;
					}
				}
				
				.right {
					display: flex;
					
					.r-text {
						margin-right: 14rpx;
						font-size: 28rpx;
						font-weight: 400;
						color: #39CCC2;
						line-height: 28rpx;
					}
					
					.iconfont {
						color: #39CCC2;
						font-size: 24rpx;
						font-weight: bold;
					}
				}
			}
		}
	
		.data-list {
			margin-top: 24rpx;
			padding: 0 24rpx;
			background: #FFFFFF;
			border-radius: 16rpx;
			
			.item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				height: 92rpx;
				font-size: 28rpx;
				
				&~.item {
					border-top: 2rpx solid #F5F5F5;
				}
				
				&:first-child {
					font-size: 32rpx;
					font-weight: bold;
					
					.lebel {
						color: #1F1F1F;
					}
				}
				
				.lebel {
					color: #666666;
				}
				
				.val {
					color: #1F1F1F;
				}
			}
		}
	}
	
	
</style>